package liumengbaio.lolzhangyoubao.Activity.Activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.view.View;

import java.util.ArrayList;
import java.util.List;

import liumengbaio.lolzhangyoubao.Activity.Adapter.ViewPagerAdapter;
import liumengbaio.lolzhangyoubao.Activity.Fragment.DiamondsFragment;
import liumengbaio.lolzhangyoubao.Activity.Fragment.GoldFragment;
import liumengbaio.lolzhangyoubao.Activity.Fragment.ZhangDouFragment;
import liumengbaio.lolzhangyoubao.R;

/**
 * Created by lanouhn on 16/9/10.
 */
public class TakeNoteActivity extends AppCompatActivity{
    private TabLayout take_note_tablayout;
    private ViewPager take_note_viewpager;
    private List<String> tabNames;
    private List<Fragment> lists;
    private DiamondsFragment diamonds_fragment;
    private GoldFragment gold_fragment;
    private ZhangDouFragment zhang_dou_fragment;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.take_note_activity);
        initView();
    }
    private void initView() {
        take_note_tablayout= (TabLayout) findViewById(R.id.take_note_tablayout);
        take_note_viewpager= (ViewPager) findViewById(R.id.take_note_viewpager);
       findViewById(R.id.head_left_title).setOnClickListener(new View.OnClickListener() {
           @Override
           public void onClick(View v) {
               finish();
           }
       });
        tabNames=new ArrayList<>();
        lists=new ArrayList<>();
        diamonds_fragment=new DiamondsFragment();
        gold_fragment=new GoldFragment();
        zhang_dou_fragment=new ZhangDouFragment();
        tabNames.add("钻石记录");
        tabNames.add("金币记录");
        tabNames.add("掌豆记录");
        lists.add(diamonds_fragment);
        lists.add(gold_fragment);
        lists.add(zhang_dou_fragment);
        take_note_viewpager.setAdapter(new ViewPagerAdapter(getSupportFragmentManager(),tabNames,lists));
        take_note_tablayout.setupWithViewPager(take_note_viewpager);
    }
}
